package com.ruoyi.patient.controller;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.patient.service.MyCartService;
import com.ruoyi.patient.service.PatientTokenService;
import com.ruoyi.patient.utils.PatientTokenFilter;
import com.ruoyi.service.service.IServiceComboService;
import com.ruoyi.service.service.IServiceItemsService;
import com.ruoyi.service.service.IServiceMycartService;
import com.ruoyi.service.service.IServicePackagesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/appPatient/appPatientTemp")
public class PatientTempDataController {


    @Autowired
    private MyCartService myCartService;

    @Autowired
    private IServiceMycartService serviceMycartService;

    @Autowired
    private IServiceComboService serviceComboService;
    @Autowired
    private IServiceItemsService serviceItemsService;
    @Autowired
    private IServicePackagesService servicePackagesService;

    @Autowired
    private PatientTokenService tokenService;

    @Autowired
    private PatientTokenFilter patientTokenFilter;


    /**
     * 订单分类查询方法
     *
     * @param
     * @return 结果
     */
    @GetMapping("/getOrderTabs")
    public AjaxResult getOrderTabs(Long hospId, HttpServletRequest request) {
        try {
            //if(!patientTokenFilter.doFilterInternal(request)) {
            //                AjaxResult ajaxResult = new AjaxResult();
            //                ajaxResult.put("code", 401);
            //                ajaxResult.put("msg", "用户信息过期，请重新登录");
            //                return ajaxResult;
            //            }
            //LoginPatient oldPatient = tokenService.getLoginUser(request);
            //if (oldPatient.getUserId() == null) {
            //    return AjaxResult.warn("用户信息错误");
            //}

            List<Map<String, String>> statusList = new ArrayList<>();

            Map<String, String> all = new HashMap<>();
            all.put("label", "全部");
            all.put("value", "all");
            statusList.add(all);

            Map<String, String> unpaid = new HashMap<>();
            unpaid.put("label", "待付款");
            unpaid.put("value", "unpaid");
            statusList.add(unpaid);

            Map<String, String> unserved = new HashMap<>();
            unserved.put("label", "待服务");
            unserved.put("value", "unserved");
            statusList.add(unserved);

            Map<String, String> serving = new HashMap<>();
            serving.put("label", "服务中");
            serving.put("value", "serving");
            statusList.add(serving);

            Map<String, String> unsettled = new HashMap<>();
            unsettled.put("label", "待结算");
            unsettled.put("value", "unsettled");
            statusList.add(unsettled);

            Map<String, String> settled = new HashMap<>();
            settled.put("label", "已结算");
            settled.put("value", "settled");
            statusList.add(settled);

            return AjaxResult.success("获取成功", statusList);
        }catch (Exception e){
            return AjaxResult.error(e.getMessage());
        }
    }




}
